package com.moonshine.service.impl;

import com.moonshine.mapper.EmpMapper;
import com.moonshine.pojo.Emp;
import com.moonshine.pojo.PageBean;
import com.moonshine.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {

    @Autowired
    private EmpMapper empMapper;
    @Override
    public List<Emp> getEmpList() {
        return null;
    }

    @Override
    public PageBean getEmpPageList(Integer pageSize, Integer pageNumber) {
        Long count = empMapper.count();

        Integer start = (pageSize - 1) * pageNumber;
        List<Emp> pageList = empMapper.getEmpPageList(start, pageNumber);

        return new PageBean(count, pageList);
    }
}
